<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    <%@ taglib uri="/struts-tags" prefix="s"%>
    <%@include file="./headMeta.jsp" %>
  </head>
  <body class="skin-blue">
    <%@include file="./header.jsp" %>
    <div class="wrapper row-offcanvas row-offcanvas-left">
        <!-- Left side column. contains the logo and sidebar -->
        <%@include file="./sidebar.jsp" %>

      <!-- Right side column. Contains the navbar and content of the page -->
      <aside class="right-side">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                员工
            </h1>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-6">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header">
                            <h3 class="box-title">修改信息</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="user/modifyUser.action?id=${id}" method="post" id="mufrm">
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="inputUsername">账号</label>
                                    <input type="text" name="username" value="${user.username }" class="form-control validate[require, maxlength=6]" id="inputUsername" placeholder="请输入员工账号" data-title="员工账号"/>
                                </div>
                                <div class="form-group">
                                    <label for="inputPwd">密码</label>
                                    <input type="text" name="pwd" value="${user.pwd }" class="form-control validate[require, expression=/[a-z0-9A-Z]/, maxlength=8,minlength=4]" id="inputPwd" placeholder="请输入员工密码" data-title="员工密码"/>
                                </div>
                                <div class="form-group">
                                    <label>权限</label>
                                    <s:if test="user.power==1">
                                      <select class="form-control" name="power">
                                          <option value="1" selected>收银人员</option>
                                          <option value="2">值班经理</option>
                                      </select>
                                    </s:if>
                                    <s:else>
                                      <select class="form-control" name="power">
                                          <option value="1">收银人员</option>
                                          <option value="2" selected>值班经理</option>
                                      </select>
                                    </s:else>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">提交</button>
                                <a class="btn btn-primary" href="user/listUser.action">返回</a>
                            </div>
                        </form>
                    </div><!-- /.box -->
                </div>
            </div><!-- /.row -->
        </section><!-- /.content -->   
      </aside>
    </div><!-- ./wrapper -->
  </body>
  <%@include file="./javascript.jsp" %>
  <script src="resource/js/validate.js" type="text/javascript"></script>
  <script>
		validate.initValidate("mufrm");
		
		$("#mufrm").submit(function(){
			if(validate.validate("mufrm") == false){
				alert(validate.error);
				return false;
			}
		});
		
	</script>
</html>
